<div class="card border-left-0 border-bottom-0 border-right-0">
    <div class="card-header py-1" ng-if="$ctrl.data.length">
        <span ng-bind="$ctrl.header"></span>
        <div class="row" ng-if="$ctrl.data[0]">
            <!-- <div class="col-md-1">
                <input type="checkbox" ng-model="$ctrl.selectedList.isSelectAll"
                    ng-change="$ctrl.selectAll($ctrl.selectedList.isSelectAll)" />
            </div> -->
            <div ng-repeat="col in $ctrl.data[0].fields | orderBy:'priority' track by $index" ng-if="$index < 4 && col.dataType != 23"
                class="col-md-2" ng-if="">                
                <div class="input-group input-group-xs">
                    <div class="input-group-prepend">
                        <div class="input-group-text"><i class="fas fa-search"></i></div>
                    </div>
                    <input type="text" class="form-control" placeholder="{{col.title}}"
                        ng-model="$ctrl.queries[col.name]" ng-enter="$ctrl.onFilterList()" />
                </div>
            </div>
            <!-- <small class="col-md-2">Author</small> -->
            <small class="col-md-2">Created Date</small>
            <div class="col-md-1">
                <div class="input-group input-group-xs">
                    <select class="custom-select custom-select-sm mr-2" ng-model="$ctrl.filterType">
                        <option ng-repeat="item in $ctrl.filterTypes" ng-value="item">{{item}}</option>
                    </select>
                </div>
            </div>
        </div>
    </div>
    <div class="card-body py-1">

        <div class="py-2" role="alert" ng-if="!$ctrl.data || !$ctrl.data.length">
            <i class="fas fa-exclamation-triangle text-warning mr-3"></i> No data has been created for this attribute
            yet!
        </div>

        <div dnd-list="$ctrl.data" dnd-inserted="$ctrl.updateOrders(index)" ng-if="$ctrl.data.length">
            <div ng-repeat="item in $ctrl.data track by $index" dnd-draggable="item" dnd-type="'item'"
                dnd-effect-allowed="copyMove" dnd-selected="$ctrl.selectedItem = item" dnd-disable-if="$crl.canDrag"
                dnd-dragstart="$ctrl.dragStart($index)" ng-class="{'selected': $ctrl.selectedItem === item}"
                class="border-bottom attr-set-value-item">
                <dnd-nodrag class="row">
                    <!-- <div  class="col-md-1 form-inline">
                        <small dnd-handle class="fa fa-grip-vertical text-black-50 mr-2" style="cursor:grab;"></small>
                        <small class="d-none">
                            <input class="ml-1 border-0 p-0 text-center text-black-50" style="width: 25px;"
                                ng-model="item.priority" />
                        </small>
                    </div> -->
                    <div ng-if="$index < 4 && val.dataType != 23" ng-repeat="val in item.values | orderBy: 'priority' track by $index"
                        class="col-md-2 py-2">
                        <attribute-value-preview data="val"></attribute-value-preview>
                    </div>
                    <!-- <div class="col-md-2">
                                <small class="text-black-50 align-middle" ng-bind="item.createdBy">
                                </small>
                            </div> -->
                    <div class="col-md-2">                        
                        <small class="text-black-50 align-middle" ng-bind="item.createdDateTime | utcToLocal">
                        </small>
                    </div>
                    <div class="col">
                        <div class="btn-group btn-group-sm float-right">
                            <!-- <a ng-click="$ctrl.sendMail(item)" class="btn btn-link text-primary">
                                        <span class="fa fa-envelope"></span>
                                    </a> -->
                            <a ng-click="$ctrl.update(item)" class="btn btn-link text-primary">
                                <span class="fa fa-pen"></span>
                            </a>
                            <a ng-click="$ctrl.delete(item)" class="btn btn-link text-danger">
                                <span class="fas fa-trash-alt"></span>
                            </a>
                        </div>
                    </div>
                </dnd-nodrag>

            </div>
        </div>
    </div>
    <div class="card-footer form-inline" ng-if="$ctrl.data.length">
        <div class="form-group">
            <select class="form-control btn custom-select custom-select-sm mr-2" ng-model="$ctrl.selectedList.action">
                <option ng-repeat="item in $ctrl.actions" ng-value="item">{{item}}</option>
            </select>
            <button type="button" class="btn btn-sm btn-primary"
                ng-if="$ctrl.selectedList.data.length > 0 && $ctrl.selectedList.action"
                ng-click="$ctrl.apply()">Apply</button>
        </div>
    </div>
</div>